using UnityEngine;

namespace Demo
{
    public class OutExample:MonoBehaviour
    {
        private int score = 0;
        private int score2 = 0;
        void Start()
        {
            Debug.Log("==========OutExample=========");
            
            Debug.Log("原始值:"+score);
            
            ChangeValue(score);
            Debug.Log("形参传递后:"+score);
            
            ChangeValue(out score);
            Debug.Log("Out修饰形参后:"+score);
            
            Debug.Log("==========OutExample==========");
        }

        void ChangeValue(int value)
        {
            value = 10;
        }

        void ChangeValue(out int value)
        {
            value = 20;
        }

        void ChangeValue(out int value, out int value2)
        {
            value = 30;
            value2 = 40;
        }
    }
}